/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wasolicitudesfiec.CambioCarreraoEspecializacion;

import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Label;
import entidad.cambioCarrera.Solicitudcambiocarrera;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.convert.DateTimeConverter;
import wasolicitudesfiec.logicacontrol.Logica;

/**
 * <p>Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 *
 * @version Informe.java
 * @version Created on Jan 9, 2009, 9:51:47 AM
 * @author kabad
 */
public class Informe extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
        dateTimeConverter1.setPattern("dd/MM/yyyy");
        dateTimeConverter1.setLocale(new java.util.Locale("es", "EC", ""));
        dateTimeConverter1.setTimeStyle("full");
        dateTimeConverter1.setTimeZone(java.util.TimeZone.getTimeZone("America/Guayaquil"));
    }
    private Label lblEstudiante = new Label();

    public Label getLblEstudiante() {
        return lblEstudiante;
    }

    public void setLblEstudiante(Label l) {
        this.lblEstudiante = l;
    }
    private Label lblMatricula = new Label();

    public Label getLblMatricula() {
        return lblMatricula;
    }

    public void setLblMatricula(Label l) {
        this.lblMatricula = l;
    }
    private Label lblFecha = new Label();

    public Label getLblFecha() {
        return lblFecha;
    }

    public void setLblFecha(Label l) {
        this.lblFecha = l;
    }
    private Label lblEstudiante2 = new Label();

    public Label getLblEstudiante2() {
        return lblEstudiante2;
    }

    public void setLblEstudiante2(Label l) {
        this.lblEstudiante2 = l;
    }
    private Label lblCarreraActual = new Label();

    public Label getLblCarreraActual() {
        return lblCarreraActual;
    }

    public void setLblCarreraActual(Label l) {
        this.lblCarreraActual = l;
    }
    private Label lblCarreraNUeva = new Label();

    public Label getLblCarreraNUeva() {
        return lblCarreraNUeva;
    }

    public void setLblCarreraNUeva(Label l) {
        this.lblCarreraNUeva = l;
    }
    private Label lblSubDecano = new Label();

    public Label getLblSubDecano() {
        return lblSubDecano;
    }

    public void setLblSubDecano(Label l) {
        this.lblSubDecano = l;
    }
    private Label lblMatricula2 = new Label();

    public Label getLblMatricula2() {
        return lblMatricula2;
    }

    public void setLblMatricula2(Label l) {
        this.lblMatricula2 = l;
    }
    private DateTimeConverter dateTimeConverter1 = new DateTimeConverter();

    public DateTimeConverter getDateTimeConverter1() {
        return dateTimeConverter1;
    }

    public void setDateTimeConverter1(DateTimeConverter dtc) {
        this.dateTimeConverter1 = dtc;
    }

    // </editor-fold>
    /**
     * <p>Construct a new Page bean instance.</p>
     */
    private String recomendaciones;

    public Informe() {
    }

    /**
     * <p>Callback method that is called whenever a page is navigated to,
     * either directly via a URL, or indirectly via page navigation.
     * Customize this method to acquire resources that will be needed
     * for event handlers and lifecycle methods, whether or not this
     * page is performing post back processing.</p>
     * 
     * <p>Note that, if the current request is a postback, the property
     * values of the components do <strong>not</strong> represent any
     * values submitted with this request.  Instead, they represent the
     * property values that were saved for this view when it was rendered.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();

        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("Informe Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
        }
        FacesMessage message;

        // </editor-fold>
        try {
            Logica logica = new Logica();
            int idSolicitud = Integer.parseInt(this.getExternalContext().getRequestParameterMap().get("idSolicitud"));
            Solicitudcambiocarrera solicitud = logica.getLogCambioCarrera().leerSolicitudCambioNivel2(idSolicitud);
           this.lblEstudiante.setText(solicitud.getEstudiante().getPersona().toString().toUpperCase());
           this.lblMatricula.setText(solicitud.getEstudiante().getMatricula());
           this.lblEstudiante2.setText(solicitud.getEstudiante().getPersona().toString().toUpperCase());
           this.lblMatricula2.setText(solicitud.getEstudiante().getMatricula());
           this.lblFecha.setText(solicitud.getFechamodificacion());
           this.lblCarreraActual.setText(solicitud.getCarreraActual().getNombre());
           this.lblCarreraNUeva.setText(solicitud.getCarreraNueva().getNombre());
this.setRecomendaciones(solicitud.getResolucion());

           this.lblSubDecano.setText(solicitud.getSubDecano().getPersona().toString());
        } catch (Exception ex) {
            message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Ocurrió un error no esperado, comuníquese con el administrador del sistema", ex.getLocalizedMessage());
            getFacesContext().addMessage(null, message);
            Logger.getLogger(Informe.class.getName()).log(Level.SEVERE, null, ex);
        }

    
}

/**
 * <p>Callback method that is called after the component tree has been
 * restored, but before any event processing takes place.  This method
 * will <strong>only</strong> be called on a postback request that
 * is processing a form submit.  Customize this method to allocate
 * resources that will be required in your event handlers.</p>
 */
@Override
    public void

preprocess() {
    }

    /**
     * <p>Callback method that is called just before rendering takes place.
     * This method will <strong>only</strong> be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    @Override
    public void

prerender() {
    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called (regardless of whether
     * or not this was the page that was actually rendered).  Customize this
     * method to release resources acquired in the <code>init()</code>,
     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
     * acquired during execution of an event handler).</p>
     */
    @Override
    public void
destroy() {
    }

    /**
     * @return the recomendaciones
     */
    public String getRecomendaciones() {
        return recomendaciones;
    }

    /**
     * @param recomendaciones the recomendaciones to set
     */
    public void setRecomendaciones(String recomendaciones) {
        this.recomendaciones = recomendaciones;
    }
    
}

